package com.tencent.iov.cowin.befsale.clue.controller.clue.assembler;

import com.tencent.iov.cowin.befsale.clue.controller.cus.vo.request.UpdateClueEmpRequest;
import com.tencent.iov.cowin.befsale.clue.domain.clue.po.ClueFail;
import com.tencent.iov.cowin.befsale.clue.value.enums.FailStatusEnum;
import com.software.boot.common.model.dao.BaseAssembler;
import com.software.boot.common.model.rest.BaseRequest;
import com.software.boot.common.model.rest.BaseResponse;
import com.software.common.enums.DeleteEnum;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author: whp
 * @Date: 2021-12-21 16:16:11
 * @Description: 线索战败审批信息表适配器，负责vo<->entity、vo<->po的转换和必要的参数检查，行为
 */
@Slf4j
public class ClueFailAssembler extends BaseAssembler<BaseResponse, BaseRequest, ClueFail> {

    public static ClueFail initQueryInfo(UpdateClueEmpRequest request, FailStatusEnum failStatusEnum) {
        ClueFail clueFail = new ClueFail();
        clueFail.setClueId(request.getClueId());
        clueFail.setDeleted(DeleteEnum.INIT.getFlag());
        switch (failStatusEnum) {
            case AGREE:
            case REFUSE:
                clueFail.setStatus(FailStatusEnum.APPROVAL_PENDING.getCode());
                break;
            case ACTIVATE:
                clueFail.setStatus(FailStatusEnum.AGREE.getCode());
                break;
            default:
                break;
        }
        return clueFail;
    }
}
